import qs from 'qs'
import {request} from '@/utils/http/axios/index'


// const BASE_API = process.V
// console.log(process.env) /v-artist/list
const BASE_API = process.env.VUE_APP_TABLE_API

enum Api {
//   LIST =  '/table/list',
  COLUMN = '/table/columns',
  LIST =  '/list',
  INFO =  '/info',
  SAVE =  '/save',
  UPDATE =  '/update',
  REMOVE =  '/remove',
}

export function listApi(tableName: string, param ) {
  return request({
    url: BASE_API + `/${tableName}` +  Api.LIST,
    method: 'POST',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    timeout: 10000,
    data: qs.stringify(param)
  })
}

export function columnsApi(param) {
  return request({
    url: BASE_API + Api.COLUMN,
    method: 'POST',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    timeout: 10000,
    data: qs.stringify(param)
  })
}

